package com.mystaggeredview.utils;

import android.content.Context;
import android.widget.ImageView;

import com.bumptech.glide.Glide;
import com.bumptech.glide.load.engine.DiskCacheStrategy;


/**
 * @Auth Mr.Jobs(乔元培)
 * @Date 2017/5/15
 * @Time 9:50
 * 别人可以拷贝我的代码，但是不能拷贝我不断往前的激情(0-0)。
 **/

public class GlideUtils {
    public static void loadNoCacheImg(Context context, ImageView view, String img_url, int placeholder) {
        Glide.with(context).load(img_url).placeholder(placeholder).skipMemoryCache(true).diskCacheStrategy(DiskCacheStrategy.RESULT).into(view);
    }
    public static void noMemeryLoad(Context activity, String url, ImageView imageView, int errorDrawable){
        Glide.with(activity).
                load(url).error(errorDrawable)
                .skipMemoryCache(true).diskCacheStrategy(DiskCacheStrategy.RESULT)
                .into(imageView);
    }
    public static void noMemeryLocalLoad(Context activity, int  url, ImageView imageView, int errorDrawable){
        Glide.with(activity).
                load(url).error(errorDrawable)
                .skipMemoryCache(true).diskCacheStrategy(DiskCacheStrategy.RESULT)
                .into(imageView);
    }


    public static void noMemeryLoadSource(Context activity, String url, ImageView imageView, int errorDrawable){
        Glide.with(activity).
                load(url).error(errorDrawable)
                .skipMemoryCache(true).diskCacheStrategy(DiskCacheStrategy.SOURCE)
                .into(imageView);
    }

    public static void noMemeryLocalSourceLoad(Context activity, String url, ImageView imageView, int errorDrawable){
        Glide.with(activity).
                load(url)
                .skipMemoryCache(true).diskCacheStrategy(DiskCacheStrategy.NONE).error(errorDrawable)
                .into(imageView);
    }

}
